package com.slj.springcloud.config;

import feign.Logger;
import feign.Retryer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class OpenFeignConfig {
    @Bean
    Logger.Level feignLoggerLevel() {
        return Logger.Level.FULL;
    }

    /**
     * private final long period;     //初始重试间隔 ，默认实现值是 100 ms
     * private final int maxAttempts; //最大重试次数，初始调用算一次，默认实现值是 5
     * private final long maxPeriod;  //最大重试间隔 ，默认实现值是 1000 ms
     *
     * @return
     */
    @Bean
    public Retryer feignRetryer() {
        return new Retryer.Default(100L, 1000L, 3);
    }
}
